﻿using Microsoft.VisualStudio.TestTools.UnitTesting;
using AMatysiak.Methods;
using System;

namespace AMatysiakTest.Methods
{
    [TestClass]
    public class SubstringFromTest
    {
        private string text = "Zwolnijmy... Ale co? Ten galop";

        [TestMethod]
        public void emptyText()
        {
            string substr = text.SubstringFrom("");
            Assert.AreEqual("Zwolnijmy... Ale co? Ten galop", substr);
        }

        [TestMethod]
        public void toSecondWord()
        {
            string substr = text.SubstringFrom("...");
            Assert.AreEqual("... Ale co? Ten galop", substr);
        }

        [TestMethod]
        public void toFirstSpace()
        {
            string substr = text.SubstringFrom(" ");
            Assert.AreEqual(" Ale co? Ten galop", substr);
        }

        [TestMethod]
        public void toOneChar()
        {
            string substr = text.SubstringFrom("?");
            Assert.AreEqual("? Ten galop", substr);
        }

        [TestMethod]
        public void oneLetter()
        {
            string substr = text.SubstringFrom("g");
            Assert.AreEqual("galop", substr);
        }

        [TestMethod]
        public void byNotExistingChar()
        {
            string substr = text.SubstringFrom("X");
            Assert.AreEqual("", substr);
        }

        [TestMethod]
        public void byFirstChar()
        {
            string substr = text.SubstringFrom("Z");
            Assert.AreEqual("Zwolnijmy... Ale co? Ten galop", substr);
        }
    }
}
